package com.aspose.cells;

import java.util.HashMap;

class zvd extends zbz {
   private int d = 0;
   HashMap a;

   zvd() {
      this.c(2162);
   }

   int a(int var1, ListObject var2) throws Exception {
      int var3 = 101 + this.a(var2.f()) + this.a(com.aspose.cells.b.a.zo.a(var2.a()));

      for(int var4 = 0; var4 < var2.getListColumns().getCount(); ++var4) {
         var3 += this.a(var2.getListColumns().get(var4), var4);
      }

      return var3;
   }

   int a(String var1) {
      return 2 + zakq.e(var1);
   }

   void b(int var1, ListObject var2) throws Exception {
      if (var2.b != null) {
         this.d = var2.b.length;
         this.c = var2.b;
      } else {
         this.a = new HashMap();
         this.d = this.a(var1, var2);
         this.c = new byte[this.d];
         byte var3 = 0;
         int var5 = var3 + 1;
         this.c[var3] = 114;
         this.c[var5++] = 8;
         this.c[var5++] = 1;
         ++var5;
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.getStartRow()), 0, this.c, var5, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.getEndRow()), 0, this.c, var5 + 2, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.getStartColumn()), 0, this.c, var5 + 4, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.getEndColumn()), 0, this.c, var5 + 6, 2);
         var5 += 8;
         this.c[var5] = 5;
         this.c[var5 + 7] = 1;
         var5 += 15;
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.getStartRow()), 0, this.c, var5, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.getEndRow()), 0, this.c, var5 + 2, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.getStartColumn()), 0, this.c, var5 + 4, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.getEndColumn()), 0, this.c, var5 + 6, 2);
         var5 += 8;
         var5 += 4;
         this.c[var5] = (byte)var2.a();
         var5 += 4;
         this.c[var5] = 1;
         var5 += 4;
         this.c[var5] = (byte)(var2.getShowTotals() ? 1 : 0);
         var5 += 4;
         this.c[var5] = 0;
         var5 += 4;
         this.c[var5] = 64;
         var5 += 4;
         this.c[var5] = 102;
         this.c[var5 + 1] = 50;
         var5 += 4;
         this.c[var5] = 0;
         if (var2.B()) {
            this.c[var5] = 6;
         }

         this.c[var5 + 1] = 0;
         if (var2.B()) {
            this.c[var5 + 1] = 8;
         }

         this.c[var5 + 2] = -34;
         var5 += 4;
         var5 += 32;
         var5 = this.a(var2.f(), var5);
         System.arraycopy(com.aspose.cells.b.a.zc.a(var2.getEndColumn() - var2.getStartColumn() + 1), 0, this.c, var5, 2);
         var5 += 2;
         var5 = this.a(com.aspose.cells.b.a.zo.a(var2.a()), var5);

         for(int var4 = 0; var4 < var2.getListColumns().getCount(); ++var4) {
            var5 = this.a(var2.getListColumns().get(var4), var4, var5);
         }

      }
   }

   static int a(zrw var0, zbvr var1) {
      int var2 = 0;
      if (var0 != null) {
         var2 += var0.d();
      }

      if (var1 != null) {
         var2 += 8 + zbvq.a(var1);
      }

      return var2;
   }

   int a(ListColumn var1, int var2) throws Exception {
      int var3 = 36 + this.a(com.aspose.cells.b.a.zo.a(0)) + this.a(var1.getName());
      zrw var4;
      if (var1.m != null) {
         var4 = new zrw(var1.m());
         var3 += a(var4, var1.a(var1.m()));
      }

      if (var1.l != null) {
         var4 = new zrw(var1.l());
         var3 += a(var4, var1.a(var1.l()));
      }

      if (var1.b()) {
         var3 += 6;
         FilterColumn var6 = var1.a();
         if (var6 != null) {
            zbf var5 = new zbf();
            var5.a(var6);
            this.a.put(var1, var5);
            var3 += var5.d();
         }
      }

      return var3;
   }

   static int a(zrw var0, zbvr var1, byte[] var2, int var3) {
      if (var0 != null) {
         System.arraycopy(var0.e(), 0, var2, var3, var0.d());
         var3 += var0.d();
      }

      if (var1 != null) {
         var3 += 6;
         System.arraycopy(com.aspose.cells.b.a.zc.a(var1.getCount()), 0, var2, var3, 2);
         var3 += 2;
         var3 = zbvq.a(var1, var2, var3);
      }

      return var3;
   }

   int a(ListColumn var1, int var2, int var3) {
      byte[] var4 = new byte[]{(byte)var1.o, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte)var1.getTotalsCalculation(), 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, 1, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1};
      zrw var5 = null;
      zrw var6 = null;
      if (var1.m != null) {
         var5 = new zrw(var1.m());
      }

      if (var1.l != null) {
         var6 = new zrw(var1.l());
      }

      if (var1.m != null) {
         var4[16] = (byte)a(var5, var1.a(var1.m()));
      }

      if (var1.l != null) {
         var4[28] = (byte)a(var6, var1.a(var1.l()));
      }

      if (!var1.b()) {
         var4[24] = 0;
      }

      System.arraycopy(var4, 0, this.c, var3, var4.length);
      var3 += var4.length;
      String var7 = com.aspose.cells.b.a.zo.a(0);
      var3 = this.a(var7, var3);
      var7 = var1.getName();
      var3 = this.a(var7, var3);
      if (var1.m != null) {
         var3 = a(var5, var1.a(var1.m()), this.c, var3);
      }

      if (var1.l != null) {
         var3 = a(var6, var1.a(var1.l()), this.c, var3);
      }

      if (var1.b()) {
         zbf var8 = (zbf)this.a.get(var1);
         if (var8 != null) {
            System.arraycopy(com.aspose.cells.b.a.zc.a(var8.d()), 0, this.c, var3, 2);
         }

         var3 += 4;
         this.c[var3] = -1;
         this.c[var3 + 1] = -1;
         var3 += 2;
         if (var8 != null) {
            System.arraycopy(var8.e(), 0, this.c, var3, var8.d());
            var3 += var8.d();
         }
      }

      return var3;
   }

   private int a(String var1, int var2) {
      System.arraycopy(com.aspose.cells.b.a.zc.a(var1.length()), 0, this.c, var2, 2);
      var2 += 2;
      byte[] var3 = zakq.a(var1);
      this.c[var2++] = (byte)(var3.length == var1.length() ? 0 : 1);
      System.arraycopy(var3, 0, this.c, var2, var3.length);
      var2 += var3.length;
      return var2;
   }

   void a(zqa var1) throws Exception {
      Object var2 = null;
      byte[] var5;
      if (this.d > 8224) {
         var5 = new byte[4];
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.f()), 0, var5, 0, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a((short)8224), 0, var5, 2, 2);
         var1.a(var5);
         var1.a(this.c, 0, 8224);
         var5 = new byte[16];
         var5[0] = var5[4] = 117;
         var5[1] = var5[5] = 8;
         int var3 = 8224;

         while(true) {
            int var4 = this.c.length - var3;
            if (var4 <= 8212) {
               System.arraycopy(com.aspose.cells.b.a.zc.a(var4 + 12), 0, var5, 2, 2);
               var1.a(var5);
               var1.a(this.c, var3, var4);
               break;
            }

            System.arraycopy(com.aspose.cells.b.a.zc.a((short)8224), 0, var5, 2, 2);
            var1.a(var5);
            var1.a(this.c, var3, 8212);
            var3 += 8212;
         }
      } else {
         var5 = new byte[4];
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.f()), 0, var5, 0, 2);
         System.arraycopy(com.aspose.cells.b.a.zc.a(this.d), 0, var5, 2, 2);
         var1.a(var5);
         var1.a(this.c);
      }

   }
}
